<<<<<<< HEAD
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 积分管理
 * @author viviqin
 *
 */
class Redmanagement extends CI_Controller {
	
	private $tab = 'system';
	
	function __construct(){
		parent::__construct();
		/** 登陆验证 */
		if(!isset($_SESSION)){
		    session_start();
		}
		$admin = $this->session->userdata('admin_user');
		if(!$admin || !isset($admin['user_id'])){
			header('Location: /sys_admin/login');
			exit;
		}
	}
	function auto_red(){
		$this->load->model('Redmanagement_model');
		$vdata['list'] = $this->Redmanagement_model->get_list();
		
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'redparameter';
		$this->load->view('/sys_admin/redmanagement/auto_red', $vdata);
	}
	

	function red_save(){
		$this->load->model('Redmanagement_model');
		$admin = $this->session->userdata('admin_user');
		if(isset($admin['type_id']) && $admin['type_id'] ==1){
			$act = $this->input->post("act");
			$parms = array(	'title'=>$this->input->post("title"),
							'money'=>$this->input->post("money"),
							'start_time'=>strtotime($this->input->post("start_time")),
							'end_time'=>strtotime($this->input->post("end_time")),
							'fstatus'=>$this->input->post("fstatus"),
						);
			$id = $this->input->post("id");
			$res = $this->Redmanagement_model->update($id,$parms);
			
			if($res>0){
				$ret = array('msg'=>'操作成功');
			}else{
				$ret = array('msg'=>'操作失败');
			}
		}else{
			$ret = array('msg'=>'对不起，权限不足！');
		}
		
		echo json_encode($ret);
		exit; 
	}
	
=======
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 积分管理
 * @author viviqin
 *
 */
class Redmanagement extends CI_Controller {
    
	private $tab = 'system';
	
	function __construct(){
		parent::__construct();
		/** 登陆验证 */
		if(!isset($_SESSION)){
		    session_start();
		}
		$admin = $this->session->userdata('admin_user');
		if(!$admin || !isset($admin['user_id'])){
			header('Location: /sys_admin/login');
			exit;
		}
	}
	function auto_red(){
		$this->load->model('Redmanagement_model');
		$vdata['list'] = $this->Redmanagement_model->get_list();
		
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'redparameter';
		$this->load->view('/sys_admin/redmanagement/auto_red', $vdata);
	}
	

	function red_save(){
		$this->load->model('Redmanagement_model');
		$admin = $this->session->userdata('admin_user');
		if(isset($admin['type_id']) && $admin['type_id'] ==1){
			$act = $this->input->post("act");
			$parms = array(	'title'=>$this->input->post("title"),
							'money'=>$this->input->post("money"),
							'start_time'=>strtotime($this->input->post("start_time")),
							'end_time'=>strtotime($this->input->post("end_time")),
							'fstatus'=>$this->input->post("fstatus"),
						);
			$id = $this->input->post("id");
			$res = $this->Redmanagement_model->update($id,$parms);
			
			if($res>0){
				$ret = array('msg'=>'操作成功');
			}else{
				$ret = array('msg'=>'操作失败');
			}
		}else{
			$ret = array('msg'=>'对不起，权限不足！');
		}
		
		echo json_encode($ret);
		exit; 
	}
	
>>>>>>> d47623b610d79a4eeb489500830c00d70933f414
}